package com.gitee.smsdistribution.intercepter;

import com.gitee.smsdistribution.model.User;

public class RequestContext {
    private static final ThreadLocal<User> userHolder = new ThreadLocal<>();

    public static void setUserHolder(User user) {
        userHolder.set(user);
    }

    public static void remove() {
        userHolder.remove();
    }

    public static String getCurrentUserName() {
        User currentUser = userHolder.get();
        return currentUser.getName();
    }
}
